<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<center>
    <form action="{url:/exam/register}" method="post">
        用户名：<input type="text" name="name" id="name"/>
        密码：<input type="password" name="pwd" id="pwd"/>
        邮箱：<input type="email" name="email" id="email"/>
        <input type="button" id="btn" value="注册"/>
    </form>
</center>
</body>
</html>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
    $("#btn").click(function(){
       var name = $("#name").val();
        var pwd = $("#pwd").val();
        var email = $("#email").val();
        if(name=="" || pwd=="" || email==""){
            alert("输入内容不能为空");
            return false;
        }
        var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9_])+\.)+([a-zA-Z0-9_]{2,4})+$/;
        if (!filter.test(email)){
            alert('您的电子邮件格式不正确');
            return false;
        }
        $("form").submit();
    });
</script>